:- module(ontology_access, 
% In principle, the complete list of access 
        [
            ontology_name/2,
            ontology_version/2,
            ontology_status/2,
            ontology_author/2,
            ontology_authoremail/2,
            ontology_affiliation/2,
            ontology_description/2,
            ontology_comment/2,
            ontology_language/2,
            ontology_metadata/3,
 %% Types
            ontology/1
            ], [assertions,basicmodes,regtypes]).



:- comment(title, "Information About the Ontology").
:- comment(subtitle, "AMOS Project").

:- comment(author, "Manuel Carro and the CLIP Group").
:- comment(author, "Facultad de Inform@'{a}tica").
:- comment(author, "Universidad Polit@'{e}cnica de Madrid").
:- comment(author, "@tt{clip@@dia.fi.upm.es}").
:- comment(author, "@tt{http://www.clip.dia.fi.upm.es/}").

:- comment(summary, " This module implements the entry point to query
about general characteristics of the ontology").

:- comment(module, "

The ontology module acts as a top-level declaration of external
properties of the ontology.  It allows @bf{consulting} data such as
version, author name and email, and names of other classes the
ontology is made of, but it does not give direct access or reexports
primitives implementing operations on the subclasses.  If the ontology
evolves, the changes will be reflected in the ontology access
implementation and in the data declared by this interface.

All the operations, but the @pred{ontology/1} constructive type
declaration, must use an already-made ontology.  E.g.,

@begin{verbatim}

?- ontology(_O), ontology_author(_O, E).

E = \"Carlo Daffara\" ? ;

@end{verbatim}

@sp

@include{../Doc/acknowledgements.lpdoc}

@newpage
").


:- include(db('argnamesv/argnamesv')).   % Kludge to use local version

:- use_module(db(basic_types)).


ontology_size(9).  %% Nine proper fields

%% Using records to have a better syntax


:- argnames is_an_ontology(
        name, 
        version,
        status,
        author,
        email,
        affiliation,
        description,
        comment,
        language,
        parent,
        children).


:- regtype ontology(?Ont) # "@var{Ont} is an ontology to store
        information about open source projects.".

ontology_children(
        [asset, 
         resource, 
         user,
         organization,
         certification,
         dictionaryItem,
         dictionary]).

ontology(Ontology):- 
        ontology_size(Size),
        RealSize is Size + 2,
        functor(Ontology, is_an_ontology, RealSize),
        ontology_children(Children),
        Ontology = is_an_ontology${name => "AMOS"},
        Ontology = is_an_ontology${version => "2.0"},
        Ontology = is_an_ontology${status => "unpublished"},
        Ontology = is_an_ontology${author => "Carlo Daffara"},
        Ontology = is_an_ontology${email => "cdaffara@conecta.it"},
        Ontology = is_an_ontology${affiliation => "Conecta srl, AMOS project"},
        Ontology = is_an_ontology${description => 

"this is the base ontology for the AMOS project.  It aims to capture
schemas and constraints for the representation of open source code
packages and the ancillary data about them."},

        Ontology = is_an_ontology${comment => "work in progress"},
        Ontology = is_an_ontology${language => lang("English", 'EN')},
        
        Ontology = is_an_ontology${parent => none},
        Ontology = is_an_ontology${children => Children}.


:- pred ontology_name(+Ont, ?Name) : 
        ontology * string  

 #"@var{Name} is the name of the ontology @var{Ont}.".

ontology_name(Ont, Name):- 
        Ont = is_an_ontology${name => Name}.


:- pred ontology_version(+Ont, ?Version):
        ontology * string

 #"@var{Version} is the version of the ontology @var{Ont}.".

ontology_version(Ont, Version):- 
        Ont = is_an_ontology${version => Version}.


:- pred ontology_status(+Ont, ?Status):
        ontology * string

 #"@var{Status} is the status of the ontology @var{Ont}.".

ontology_status(Ont, Status):- 
        Ont = is_an_ontology${status => Status}.


:- pred ontology_author(+Ont, ?Author):
        ontology * string

 #"@var{Author} is the author name of the ontology @var{Ont}.".

ontology_author(Ont, Author):- 
        Ont = is_an_ontology${author => Author}.


 %% :- pred ontology_subClassOf(+Ont, ?Parent).
 %%         ontology * string
 %% 
 %%  #"@var{Author} is the author name of the ontology @var{Ont}.
 %% Otherwise, @var{Ont} and @var{Ont} have the same members.".
 %% 
 %% 
 %% ontology_subClassOf(_Ont, _Parent, _Ont).


:- pred ontology_authoremail(+Ont, ?Email):
        ontology * string

 #"@var{Email} is the author email of the ontology @var{Ont}.".

ontology_authoremail(Ont, Email):- 
        Ont = is_an_ontology${email => Email}.


:- pred ontology_affiliation(+Ont, ?Affiliation):
        ontology * string

 #"@var{Affiliation} is the affiliation of the author of the ontology
@var{Ont}.".

ontology_affiliation(Ont, Affiliation):- 
        Ont = is_an_ontology${affiliation => Affiliation}.


:- pred ontology_description(+Ont, ?Description):
        ontology * string

 #"@var{Description} is a short description of the ontology
@var{Ont}.".

ontology_description(Ont, Description):- 
        Ont = is_an_ontology${description => Description}.



:- pred ontology_comment(+Ont, ?Comment):
        ontology * string

 #"@var{Comment} describes the current status of the ontology
@var{Ont}.".


ontology_comment(Ont, Comment):- 
        Ont = is_an_ontology${comment => Comment}.
                

:- pred ontology_language(+Ont, ?Language):
        ontology * language 

 #"@var{Language} is the language name of the ontology @var{Ont}.".

ontology_language(Ont, Language):- 
        Ont = is_an_ontology${language => Language}.


:- pred ontology_metadata(+Ont, ?Parent, ?Children) :
        ontology * atm * list(atm)

#"@var{Parent} is the parent class of @var{Ont} (or 'none' if
@var{Ont} does not have parents). @var{Children} is the list of
classes @var{Ont} has as children".

ontology_metadata(Ontology, Parent, Children):-
        Ontology = is_an_ontology${parent => Parent, children => Children}.


:- comment(version_maintenance,on).

:- comment(version(0*1+2,2003/07/04,12:56*10+'CEST'), "Changed
   use_module and include references to use directory aliases.  (Jesus
   Correas Fernandez)").

:- comment(version(0*1+1,2003/02/14,12:05*52+'CET'), "Added module
explanation, updated arities, now working (Manuel Carro)").

:- comment(version(0*1+0,2003/02/13,13:30*10+'CET'), "First version
(Manuel Carro)").

